const title = ['#', '操作用户', '操作内容', '操作IP', '操作时间'];
const label = ['order', 'username', 'operation', 'userIp', 'createTime'];
$(function () {
    loadLogs();
})

function loadLogs(_pageIndex) {
    let pageIndex = parseInt(_pageIndex ? _pageIndex : '1');
    showLoading(LOADING);
    getJson("/sys/log/list",{
        searchValue: $('#param-id').val(),
        currentPage: pageIndex,
        pageSize: 10
    },'GET',function (result) {
            if (result.code == 200) {
                let data = result['payload']['data'];
                setPage($('#page'), pageIndex, result['payload']['pages'], result['payload']['total'], function (num) {
                    loadLogs(num);
                });
                let order = 1 + 10 * (pageIndex - 1);
                for (let item of data) {
                    item['order'] = order++;
                }
                buildTable($('#logList'), title, label, data, function (td, label, item) {
                })
                hideLoading();
            } else {
                hideLoading();
                myAlert("提示", result.message)
            }
        }
    )
}

$("#page").paging({
    pageNo: 1,
    totalPage: 3,
    totalSize: 10,
    callback: function (num) {
    }
});